#ifndef USERMANAGEMENTWIDGET_H
#define USERMANAGEMENTWIDGET_H
#include <ui_usermanagementwidget.h>
#include <QWidget>
#include <QSqlQuery>
#include <QSqlError>
#include <QSqlDatabase>
#include <QTableWidgetItem>
#include <QMessageBox>
#include <QPushButton>
#include <QDebug>
#include <QInputDialog>
#include <algorithm.h>
#include <resultwidget.h>
#include "journeymodels.h"
#include <QDir>
#include <QSet>
#include <QCheckBox>

namespace Ui {
class UserManagementWidget;
}

class UserManagementWidget : public QWidget
{
    Q_OBJECT

public:
    explicit UserManagementWidget(QWidget *parent = nullptr);
    ~UserManagementWidget();

    void loadUserInfo();


signals:
    void openMap();
    void deletingCompleted();

private slots:
    void on_mapButton_clicked();


private:
    Ui::UserManagementWidget *ui;
    QString currentUserId;

    void loadBookingHistory();
    void cancelBooking(int bookingID);
    void rescheduleBooking(int segmentID, int bookingID, QString fromCity, QString toCity);
    void updateBookingInDatabase(int bookingID, const FlightJourney& journey);
    void updateSegmentInDatabase(int segmentID, const FlightSegment& updatedSegment);
    void updateJourneyInDatabase(int journeyID);
    int getSegmentIDFromDatabase(const FlightSegment& segment);
    FlightJourney getJourneyByID(int journeyID);
    void configureSpecialServices(int segmentID);
    void loadSpecialServices(int segmentID, QCheckBox *mealService, QCheckBox *loungeService, QCheckBox *extraBaggage);
    void saveSpecialServices(int segmentID, bool meal, bool lounge, bool baggage, double totalPrice);

};

#endif // USERMANAGEMENTWIDGET_H
